import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 班级卫生检查信息 */
export interface ReportClassHygiene {
  id: number // 编号
  schoolCode?: string // 园区
  gradeId?: number // 年级ID
  gradeName: string // 年级名称
  classId?: number // 班级ID
  className: string // 班级名称
  checkDate?: string | Dayjs // 检查时间
  checkUserNames: string // 检查人
  checkContent: string // 检查内容
  checkResult?: number // 是否需要整改
  fixResult?: number // 整改结果
  score?: number // 检查分数
  sort?: number // 排序
  status?: number // 状态
}

// 班级卫生检查 API
export const ReportClassHygieneApi = {
  // 查询班级卫生检查分页
  getReportClassHygienePage: async (params: any) => {
    return await request.get({ url: `/school/report-class-hygiene/page`, params })
  },

  // 查询班级卫生检查详情
  getReportClassHygiene: async (id: number) => {
    return await request.get({ url: `/school/report-class-hygiene/get?id=` + id })
  },

  // 新增班级卫生检查
  createReportClassHygiene: async (data: ReportClassHygiene) => {
    return await request.post({ url: `/school/report-class-hygiene/create`, data })
  },

  // 修改班级卫生检查
  updateReportClassHygiene: async (data: ReportClassHygiene) => {
    return await request.put({ url: `/school/report-class-hygiene/update`, data })
  },

  // 删除班级卫生检查
  deleteReportClassHygiene: async (id: number) => {
    return await request.delete({ url: `/school/report-class-hygiene/delete?id=` + id })
  },

  /** 批量删除班级卫生检查 */
  deleteReportClassHygieneList: async (ids: number[]) => {
    return await request.delete({
      url: `/school/report-class-hygiene/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出班级卫生检查 Excel
  exportReportClassHygiene: async (params) => {
    return await request.download({ url: `/school/report-class-hygiene/export-excel`, params })
  }
}
